<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图表测试</title>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
    <style>
        #test-chart {
            width: 100%;
            height: 400px;
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
    <h1>ECharts测试</h1>
    <div id="test-chart"></div>
    
    <script>
        console.log('开始测试ECharts...');
        
        // 等待DOM加载完成
        document.addEventListener('DOMContentLoaded', function() {
            console.log('DOM加载完成');
            
            const chartDom = document.getElementById('test-chart');
            console.log('图表容器:', chartDom);
            
            if (chartDom) {
                const myChart = echarts.init(chartDom);
                console.log('图表实例:', myChart);
                
                const option = {
                    title: {
                        text: '测试图表'
                    },
                    tooltip: {},
                    xAxis: {
                        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                    },
                    yAxis: {},
                    series: [{
                        name: '销量',
                        type: 'bar',
                        data: [120, 200, 150, 80, 70, 110, 130]
                    }]
                };
                
                myChart.setOption(option);
                console.log('图表渲染完成');
            } else {
                console.error('图表容器未找到');
            }
        });
    </script>
</body>
</html> 